//9:输入一个整数，判断其是否是回文数，回文数是指这个数颠倒后，和原数相同那个。
package ZUOYE0421;

import java.util.Scanner;

import javax.swing.plaf.SliderUI;

public class 作业九 {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		System.out.println("输入一个数：");
		int num = in.nextInt();
		int a = 1, b = 1, sn = 0;
		int num1 = num;
		for (;;) {
			a = a * 10;
			if (num % a == num) {
				a = a / 10;
				break;
			}
		}
		for (;;) {
			b = num % 10;
			num = num / 10;
			b = b * a;
			a = a / 10;
			sn = sn + b;
			if (num % 10 == num) {
				System.out.println("颠倒后的数为：" + (num + sn));
				break;
			}

		}
		if ((num + sn) == num1) {
			System.out.println("该为回文数");
		} else {
			System.out.println("该不是回文数");
		}
	}

}
